.class public Lcn/sharesdk/framework/b/a/b;
.super Ljava/lang/Object;


# static fields
.field private static c:Lcn/sharesdk/framework/b/a/b;


# instance fields
.field private a:Landroid/content/Context;

.field private b:Lcn/sharesdk/framework/b/a/a;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    const/4 v0, 0x0

    sput-object v0, Lcn/sharesdk/framework/b/a/b;->c:Lcn/sharesdk/framework/b/a/b;

    return-void
.end method

.method private constructor <init>(Landroid/content/Context;)V
    .registers 4

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcn/sharesdk/framework/b/a/b;->a:Landroid/content/Context;

    new-instance v0, Lcn/sharesdk/framework/b/a/a;

    iget-object v1, p0, Lcn/sharesdk/framework/b/a/b;->a:Landroid/content/Context;

    invoke-direct {v0, v1}, Lcn/sharesdk/framework/b/a/a;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcn/sharesdk/framework/b/a/b;->b:Lcn/sharesdk/framework/b/a/a;

    return-void
.end method

.method public static declared-synchronized a(Landroid/content/Context;)Lcn/sharesdk/framework/b/a/b;
    .registers 3

    const-class v1, Lcn/sharesdk/framework/b/a/b;

    monitor-enter v1

    :try_start_3
    sget-object v0, Lcn/sharesdk/framework/b/a/b;->c:Lcn/sharesdk/framework/b/a/b;

    if-nez v0, :cond_e

    new-instance v0, Lcn/sharesdk/framework/b/a/b;

    invoke-direct {v0, p0}, Lcn/sharesdk/framework/b/a/b;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcn/sharesdk/framework/b/a/b;->c:Lcn/sharesdk/framework/b/a/b;

    :cond_e
    sget-object v0, Lcn/sharesdk/framework/b/a/b;->c:Lcn/sharesdk/framework/b/a/b;
    :try_end_10
    .catchall {:try_start_3 .. :try_end_10} :catchall_12

    monitor-exit v1

    return-object v0

    :catchall_12
    move-exception v0

    monitor-exit v1

    throw v0
.end method


# virtual methods
.method public a(Ljava/lang/String;)I
    .registers 7

    const/4 v2, 0x0

    const/4 v0, 0x0

    iget-object v1, p0, Lcn/sharesdk/framework/b/a/b;->b:Lcn/sharesdk/framework/b/a/a;

    invoke-virtual {v1}, Lcn/sharesdk/framework/b/a/a;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v1

    :try_start_8
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "select count(*) from "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    const/4 v4, 0x0

    invoke-virtual {v1, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v2

    invoke-interface {v2}, Landroid/database/Cursor;->moveToNext()Z

    move-result v1

    if-eqz v1, :cond_2b

    const/4 v1, 0x0

    invoke-interface {v2, v1}, Landroid/database/Cursor;->getInt(I)I
    :try_end_2a
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_2a} :catch_2f
    .catchall {:try_start_8 .. :try_end_2a} :catchall_37

    move-result v0

    :cond_2b
    invoke-interface {v2}, Landroid/database/Cursor;->close()V

    :goto_2e
    return v0

    :catch_2f
    move-exception v1

    :try_start_30
    invoke-static {v1}, Lcn/sharesdk/framework/utils/e;->b(Ljava/lang/Throwable;)I
    :try_end_33
    .catchall {:try_start_30 .. :try_end_33} :catchall_37

    invoke-interface {v2}, Landroid/database/Cursor;->close()V

    goto :goto_2e

    :catchall_37
    move-exception v0

    invoke-interface {v2}, Landroid/database/Cursor;->close()V

    throw v0
.end method

.method public a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I
    .registers 11

    const/4 v6, 0x1

    const/4 v2, 0x0

    iget-object v0, p0, Lcn/sharesdk/framework/b/a/b;->b:Lcn/sharesdk/framework/b/a/a;

    invoke-virtual {v0}, Lcn/sharesdk/framework/b/a/a;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    :try_start_8
    invoke-virtual {v0, p1, p2, p3}, Landroid/database/sqlite/SQLiteDatabase;->delete(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I
    :try_end_b
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_b} :catch_1f

    move-result v0

    :try_start_c
    const-string v1, "Deleted %d rows from table: %s"

    const/4 v3, 0x2

    new-array v3, v3, [Ljava/lang/Object;

    const/4 v4, 0x0

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    aput-object v5, v3, v4

    const/4 v4, 0x1

    aput-object p1, v3, v4

    invoke-static {v1, v3}, Lcn/sharesdk/framework/utils/e;->a(Ljava/lang/Object;[Ljava/lang/Object;)I
    :try_end_1e
    .catch Ljava/lang/Exception; {:try_start_c .. :try_end_1e} :catch_2c

    :goto_1e
    return v0

    :catch_1f
    move-exception v0

    move-object v1, v0

    move v0, v2

    :goto_22
    const-string v3, "when delete database occur error table:%s,"

    new-array v4, v6, [Ljava/lang/Object;

    aput-object p1, v4, v2

    invoke-static {v1, v3, v4}, Lcn/sharesdk/framework/utils/e;->a(Ljava/lang/Throwable;Ljava/lang/Object;[Ljava/lang/Object;)I

    goto :goto_1e

    :catch_2c
    move-exception v1

    goto :goto_22
.end method

.method public a(Ljava/lang/String;Landroid/content/ContentValues;)J
    .registers 9

    iget-object v0, p0, Lcn/sharesdk/framework/b/a/b;->b:Lcn/sharesdk/framework/b/a/a;

    invoke-virtual {v0}, Lcn/sharesdk/framework/b/a/a;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    const-wide/16 v0, -0x1

    const/4 v3, 0x0

    :try_start_9
    invoke-virtual {v2, p1, v3, p2}, Landroid/database/sqlite/SQLiteDatabase;->replace(Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;)J
    :try_end_c
    .catch Ljava/lang/Exception; {:try_start_9 .. :try_end_c} :catch_e

    move-result-wide v0

    :goto_d
    return-wide v0

    :catch_e
    move-exception v2

    const-string v3, "when insert database occur error table:%s,"

    const/4 v4, 0x1

    new-array v4, v4, [Ljava/lang/Object;

    const/4 v5, 0x0

    aput-object p1, v4, v5

    invoke-static {v2, v3, v4}, Lcn/sharesdk/framework/utils/e;->a(Ljava/lang/Throwable;Ljava/lang/Object;[Ljava/lang/Object;)I

    goto :goto_d
.end method

.method public a(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
    .registers 15

    iget-object v0, p0, Lcn/sharesdk/framework/b/a/b;->b:Lcn/sharesdk/framework/b/a/a;

    invoke-virtual {v0}, Lcn/sharesdk/framework/b/a/a;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    const-string v1, "Query table: %s"

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    aput-object p1, v2, v3

    invoke-static {v1, v2}, Lcn/sharesdk/framework/utils/e;->a(Ljava/lang/Object;[Ljava/lang/Object;)I

    const/4 v8, 0x0

    const/4 v5, 0x0

    const/4 v6, 0x0

    move-object v1, p1

    move-object v2, p2

    move-object v3, p3

    move-object v4, p4

    move-object v7, p5

    :try_start_19
    invoke-virtual/range {v0 .. v7}, Landroid/database/sqlite/SQLiteDatabase;->query(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
    :try_end_1c
    .catch Ljava/lang/Exception; {:try_start_19 .. :try_end_1c} :catch_1e

    move-result-object v0

    :goto_1d
    return-object v0

    :catch_1e
    move-exception v0

    const-string v1, "when query database occur error table:%s,"

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    aput-object p1, v2, v3

    invoke-static {v0, v1, v2}, Lcn/sharesdk/framework/utils/e;->a(Ljava/lang/Throwable;Ljava/lang/Object;[Ljava/lang/Object;)I

    move-object v0, v8

    goto :goto_1d
.end method
